package com.rightin.reader.hf.rfidenum;

import java.util.HashMap;

public enum EnumBaudRate {
    BaudRate9600(150),
    BaudRate19200(25),
    BaudRate38400(56),
    BaudRate57600(87),
    BaudRate115200(17),
    BaudRateDefault(255);
    
    private int intValue;
    private static HashMap<Integer, EnumBaudRate> mappings;

    private static synchronized HashMap<Integer, EnumBaudRate> getMappings() {
        if (mappings == null) {
            mappings = new HashMap<>();
        }
        return mappings;
    }

    EnumBaudRate(int value) {
        this.intValue = value;
        getMappings().put(value, this);
    }

    public int getValue() {
        return this.intValue;
    }

    public static EnumBaudRate forValue(int value) {
        return getMappings().get(value);
    }
}
